/**
 * @author LKQ
 * @date 2022/3/2 16:18
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.distributeCandies(10, 3);
    }
    public int[] distributeCandies(int candies, int num_people) {
        int[] ans = new int[num_people];
        boolean finish = true;
        int start = 1;
        while (finish) {
            int  i = 0;
            for (; i < num_people; i++) {
                ans[i] += Math.min(candies, start);
                candies -= start;
                if (candies <= 0) {
                    finish = false;
                    break;
                }
                start++;
            }
        }
        return ans;
    }
}
